package edu.sctu.liangyuxiang.day20150614;

import java.io.*;


/**
 * Created by user20 on 2015/6/14.
 */
public class IOUntil {
    public void ioUntil()throws Exception{
        File file = new File("D://11.bmp");
        File file1 = new File("D://12.bmp");
        byte[] byte3 = new byte[1024];

            FileInputStream fileInputStream = new FileInputStream(file);
            FileOutputStream fileOutputStream = new FileOutputStream(file1);

            int byte1 = 0;
            int byte2 = 0;

                while ((byte1 = fileInputStream.read(byte3))!=-1){
                    byte2+=byte1;
                }
        fileOutputStream.write(byte3);
        System.out.println(byte2);
    }

    public void charUntil()throws Exception{
        File file = new File("D://21.txt");
        File file1 = new File("D://22.txt");

        int i = 0;
        char[] char1 = new char[1024];

        FileReader fileReader = new FileReader(file);
        FileWriter fileWriter = new FileWriter(file1);

        while ((i = fileReader.read(char1))!=-1){
            new String(char1);
            System.out.println(char1);
            fileWriter.write(char1,0,i);
        }


    }
}
